package com.jlcindia.hibernate;
import org.hibernate.*;
import org.hibernate.cfg.*;
public class Lab35 
{
	public static void main(String args[])
	{
		Transaction tx=null;
		try
		{
			SessionFactory sf=HibernateUtil.getSessionFactory();
			Session session=sf.openSession();
			tx=session.beginTransaction();
			Customer cust=new Customer("Gaurav","gaurav@jlc.vom",81235469);
			Integer in=(Integer)session.save(cust);
			int cid=in.intValue();
			System.out.println("cid:"+cid);
			tx.commit();
		}
		catch (Exception e) 
		{
			e.printStackTrace();
			if(tx!=null)
				tx.rollback();
		}
	}
}
